﻿//动态显示系统时间
$(function(){
$('#time').html(new Date().toLocaleString());
setInterval("$('#time').html(new Date().toLocaleString());",1000);
});
$(function(){
	//高度自适应	
	initLayout();   
	$(window).resize(function(){   
		initLayout();   
	});	
});
function initLayout() {   
	var sh = document.documentElement.clientHeight - 70; //设置leftpanel和main高度
	$('#leftpanel').height(sh); 
	$('#main').height(sh);
		
	var lh = $('#leftpanel').height();	//	
	$('#nav_list').height(lh-10);
	$('#mainiframe').height(lh-41);
		
	var mh = document.documentElement.clientWidth- $('#leftpanel').width()- 16;//main的宽度
	$('#main').width(mh);
	$('#mainiframe').width(mh);
	$('#topmenu').width(mh-30);

	var nlw  = $('#leftpanel').width();//nav_list宽度
	$('#nav_list').width(nlw-12);
}
function editinfo(){
	var iframe = $(this.iframe).contents();	 
	iframe.find("#editsubmit").click();
	return false;
}
function editpwd(){
	var iframe = $(this.iframe).contents();	 
	iframe.find("#editPwdSubmit").click();
	return false;
}
//左侧导航点击添加样式和在主页添加导航栏的内容
$(function(){
	$active= $("#adminmenu").find(".itemarea");
	$active.click(function(){
	 $active.removeClass("active");
	 $(this).addClass("active");
	 $(".pagetitle").html($(this).text());
	 });
	}) ;

$(function(){
setInterval(getcount,3000);
})

function getcount(){
$.ajax({
	dataType:'json',
	type:'post',
	url:'getOrderAndReview.action',
	success:function(data){
	if(data.ordercount>0){
		$(".ordermsg").html(data.ordercount);
	}else{$(".ordermsg").html("");
	}
	if(data.reviewcount>0){
		$(".reviewmsg").html(data.reviewcount);
	}else{$(".reviewmsg").html("");
	}
	}
})

}

/*$(document).ready(function(){
  setInterval(showTime, 1000);                                       
  function showTime(){                                
       var today = new Date();
       var weekday=new Array(7);
       weekday[0]="星期一"
       weekday[1]="星期二"
       weekday[2]="星期三"
       weekday[3]="星期四"
       weekday[4]="星期五"
       weekday[5]="星期六"
       weekday[6]="星期日"                                        
       var y=today.getFullYear()+"年-";
       var month=today.getMonth()+"月-";
       var td=today.getDate()+"日";
       var d=weekday[today.getDay()];
       var h=today.getHours();
       var m=today.getMinutes();
       var s=today.getSeconds();        
       $("#time").text(y+month+td+" "+d+" "+h+":"+m+":"+s);
  }        
})*/